insert multiple columns in views

Hi,

I want to insert in a view a first column called 'Prefixe'.
that is my code :

load view "01 - Typage des objets"
Column col = insert (column 0)
attribute(col, "AS Prefixe Id")
title(col, "Prefixe")
print "Ajout de la colonne Prexixe\n"
save view "01 - Typage des objets

As result, the view contains 26 new columns "Prefixe" !!!!
There is no "for" loop in my code !
Estebell - Thu Sep 27 08:43:04 EDT 2012

Re: insert multiple columns in views
llandale - Thu Sep 27 12:54:42 EDT 2012

Your code will add that column each time it is run; so it appears you have ran it (while testing) 26 times.

I would amend it such that if the existing column 0 is already your attribute, then don't do anything. Maybe also amend it such that if the existing column 1 is already your attribute, then delete that column. Do that in a loop.

-Louie

Re: insert multiple columns in views
Estebell - Fri Sep 28 08:32:22 EDT 2012

llandale - Thu Sep 27 12:54:42 EDT 2012
Your code will add that column each time it is run; so it appears you have ran it (while testing) 26 times.

I would amend it such that if the existing column 0 is already your attribute, then don't do anything. Maybe also amend it such that if the existing column 1 is already your attribute, then delete that column. Do that in a loop.

-Louie

Yes it is what I done : insert a column at position 1 and delete the new 0 one.
thanks.

Re: insert multiple columns in views
Mathias Mamsch - Fri Sep 28 10:57:13 EDT 2012

Estebell - Fri Sep 28 08:32:22 EDT 2012
Yes it is what I done : insert a column at position 1 and delete the new 0 one.
thanks.

Maybe you forgot to set the current module, and you are trying to do that in a loop? The functions you are using operate on the current module, after you load the view, this could be any module, depending on the DXL in the view. So you should in all cases reset the current module, before using insert or other functions. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS